home *** CD-ROM | disk | FTP | other *** search
- Path: news.ov.com!news
- From: glenn@ov.com (Fletcher.Glenn@ov.com)
- Newsgroups: comp.lang.c
- Subject: Re: directory functions ...
- Date: 22 Jan 1996 22:44:47 GMT
- Organization: OpenVision
- Message-ID: <4e140v$e80@spanky.pls.ov.com>
- References: <30FF91CE.3F54@ehvvs5.nwg.dec.com>
- Reply-To: glenn@ov.com
- NNTP-Posting-Host: foghorn.pls.ov.com
-
- In article 3F54@ehvvs5.nwg.dec.com, Hussein Salem <salem@ehvvs5.nwg.dec.com> writes:
- >Hi,
- >
- >I'm trying to make a small program in C handling a directory. open it and print it's content
- >:
- >
- >
- >The problem is it can't read it ! Why ? I 've set the mode to a+rwx to that direstory !
- >
- >These are the code and if you know what's the problem please tell me why ?
- >
- >-----------------
- >
- >#include <stdio.h>
- >#include <dirent.h>
- >#include <sys/types.h>
- >#define MYMAX 14
- >
- >typedef struct {
- > long ino;
- > char name[MYMAX+1];
- >} Dirent;
- >
- >main(int argc,char **argv){
- >char name[MYMAX];
- >DIR *dfd;
- >char *dir;
- >Dirent *dp;
- >
- >dir = "/usr/users/salem/test";
- >
- >if ((dfd = opendir(dir) == NULL)) {
-
- You really want to say:
-
- if ((dfd = opendir(dir)) == NULL) {
-
- [irrelevant remainder snipped]
-
- Fletcher.Glenn@ov.com
-
-
-